<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #673ab7;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 300px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}

.avatar {
  width: 300px;
  height: 178px;
  display: block;
}
</style>

<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>


      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:employeefiles:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="employeefilesList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="姓名" align="center" prop="name" />
      <el-table-column label="性别" align="center" prop="gender" />
      <el-table-column label="年龄" align="center" prop="age" />
      <el-table-column label="出生日期" align="center" prop="dateOfBirth" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.dateOfBirth, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
         <el-table-column label="是否已婚" align="center" prop="isMarriage"  />
      <el-table-column label="是否生育" align="center" prop="isBirth"  />
      <el-table-column label="是否已婚" align="center" prop="isMarriage" >
        <template  slot-scope="scope">
          <span >
          {{scope.row.isMarriage}}
          </span>
                 <span v-if="scope.row.isMarriage == 1">
              是
            </span>
        </template>
      </el-table-column>
      <el-table-column label="是否生育" align="center" prop="isBirth" >
        <template  slot-scope="scope">
          <span>
            {{scope.row.isBirth}}
          </span>
                 <span v-if="scope.row.isBirth == 0">
              否
            </span>
          <span v-if="scope.row.isBirth == 1">
              是
            </span>
        </template>
      </el-table-column>
      <el-table-column label="民族" align="center" prop="ethnicGroup" />
      <el-table-column label="政治面貌" align="center" prop="politicalOutlook" />
      <el-table-column label="证件类型" align="center" prop="documentType" />
      <el-table-column label="证件号码" width="180" align="center" prop="identificationNumber" />
      <el-table-column label="户籍所在地" width="130" :show-overflow-tooltip="true" align="center" prop="registeredResidence" />
      <el-table-column label="电话号码" width="120" align="center" prop="phone" />
      <el-table-column label="邮箱" width="160" align="center" prop="mailbox" />
      <el-table-column label="现住地址" width="120" align="center" prop="currentAddress" />
      <el-table-column label="紧急联系人" width="120" :show-overflow-tooltip="true" align="center" prop="emergencyContact" />
      <el-table-column label="紧急联系人电话" width="140" align="center" prop="emergencyContactNumber" />
      <el-table-column label="学校名称" width="130" align="center" prop="schoolName" />
      <el-table-column label="学历" align="center" prop="education" />
      <el-table-column label="所学专业" width="160" align="center" prop="major" />
      <el-table-column label="操作" width="160" align="center" class-name="small-padding fixed-width" fixed="right">

        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-share"
            @click="playVideo(scope.row.id)"
            v-hasPermi="['system:employeefiles:query']"
          >查看档案
          </el-button>


        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <el-dialog :title="title" :before-close="closeVideo" :visible.sync="videoVisible" width="90%" append-to-body>

      <el-descriptions class="margin-top" title="" :column="5" size="size" :colon='false' border>
        <el-descriptions-item label="姓名" size="medium"> {{ employeefiles.name }}</el-descriptions-item>
        <el-descriptions-item label="性别">{{ employeefiles.gender }}</el-descriptions-item>
        <el-descriptions-item label="年龄">{{ employeefiles.age }}</el-descriptions-item>
        <el-descriptions-item label="学历">{{ employeefiles.education }}</el-descriptions-item>
        <el-descriptions-item label="电话">{{ employeefiles.phone }}</el-descriptions-item>
        <el-descriptions-item label="到岗日期">{{ employeefiles.employmentDate }}</el-descriptions-item>
        <el-descriptions-item label="岗位">{{ employeefiles.positionApplied }}</el-descriptions-item>
       <!-- <el-descriptions-item label="驻场企业">{{ employeefiles.enterprise }}</el-descriptions-item>-->
      </el-descriptions>

      <template>
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane label="基本信息" name="first">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(employeefiles.id)"
              v-hasPermi="['system:employeefiles:edit']">编辑
            </el-button>
            <el-descriptions title="基本信息">
              <!--                    <el-descriptions-item label="ID">{{ employeefiles.id }}</el-descriptions-item>-->
              <el-descriptions-item label="姓名">{{ employeefiles.name }}</el-descriptions-item>
              <el-descriptions-item label="性别">{{ employeefiles.gender }}</el-descriptions-item>
              <el-descriptions-item label="年龄">{{ employeefiles.age }}</el-descriptions-item>
              <el-descriptions-item label="出生年月">{{ employeefiles.dateOfBirth }}</el-descriptions-item>
              <el-descriptions-item label="是否已婚">{{ employeefiles.isMarriage }}</el-descriptions-item>
              <el-descriptions-item label="是否生育">{{ employeefiles.isBirth }}</el-descriptions-item>
              <el-descriptions-item label="民族">{{ employeefiles.ethnicGroup }}</el-descriptions-item>
              <el-descriptions-item label="政治面貌">{{ employeefiles.politicalOutlook }}</el-descriptions-item>
              <el-descriptions-item label="证件类型">{{ employeefiles.documentType }}</el-descriptions-item>
              <el-descriptions-item label="证件号码">{{ employeefiles.identificationNumber }}</el-descriptions-item>
              <el-descriptions-item label="户籍所在地">{{ employeefiles.registeredResidence }}</el-descriptions-item>
            </el-descriptions>

            <el-descriptions title="通讯信息">
              <el-descriptions-item label="电话">{{ employeefiles.phone }}</el-descriptions-item>
              <el-descriptions-item label="邮箱">{{ employeefiles.mailbox }}</el-descriptions-item>
              <el-descriptions-item label="现住地址">{{ employeefiles.currentAddress }}</el-descriptions-item>
              <el-descriptions-item label="紧急联系人">{{ employeefiles.emergencyContact }}</el-descriptions-item>
              <el-descriptions-item label="紧急联系人电话">{{
                  employeefiles.emergencyContactNumber
                }}
              </el-descriptions-item>
            </el-descriptions>
            <el-descriptions title="学历信息">
              <el-descriptions-item label="学校名称">{{ employeefiles.schoolName }}</el-descriptions-item>
              <el-descriptions-item label="学历">{{ employeefiles.education }}</el-descriptions-item>
              <el-descriptions-item label="所学专业">{{ employeefiles.major }}</el-descriptions-item>
            </el-descriptions>
          </el-tab-pane>
          <el-tab-pane label="工作信息" name="second">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate1(employeefiles.id)"
              v-hasPermi="['system:employeefiles:edit']">编辑
            </el-button>
            <el-descriptions title="工作信息">
              <el-descriptions-item label="岗位名称">{{ employeefiles.positionApplied }}</el-descriptions-item>
              <el-descriptions-item label="职位">{{ employeefiles.post }}</el-descriptions-item>
              <el-descriptions-item label="入职时间">{{ employeefiles.employmentDate }}</el-descriptions-item>
              <el-descriptions-item label="试用期">{{ employeefiles.probationPeriod }}</el-descriptions-item>
              <el-descriptions-item label="转正日期">{{parseTime(employeefiles.zzTime, '{y}-{m}-{d}') }}</el-descriptions-item>
             <!-- <el-descriptions-item label="签约公司">{{ employeefiles.enterprise }}</el-descriptions-item>
              <el-descriptions-item label="驻场企业">{{ employeefiles.enterprise }}</el-descriptions-item>-->
              <el-descriptions-item label="工作地点">{{ employeefiles.wokeAddress }}</el-descriptions-item>
              <el-descriptions-item label="部门">{{ employeefiles.dname }}</el-descriptions-item>
              <el-descriptions-item label="工作性质">{{ employeefiles.workNature }}</el-descriptions-item>
              <el-descriptions-item label="岗位类型">{{ employeefiles.positionType }}</el-descriptions-item>
            </el-descriptions>
          </el-tab-pane>

          <el-tab-pane label="合同信息" name="third">
            <el-table :data="contract" stripe style="width: 100%">
              <el-table-column prop="name" label="姓名" width="180"></el-table-column>
              <el-table-column prop="positionApplied" label="岗位" width="180"></el-table-column>
            <!--  <el-table-column prop="enterPrise" label="驻场企业" width="180"></el-table-column>-->
              <el-table-column prop="type" label="合同类型" width="180"></el-table-column>
              <el-table-column prop="contractStatus" label="合同状态" width="180"></el-table-column>
              <el-table-column prop="contractPeriod" label="合同期限" width="180"></el-table-column>
              <el-table-column prop="auditTime" label="合同签署日期" width="180"></el-table-column>
              <el-table-column prop="endTime" label="合同结束日期" width="180"></el-table-column>
              <el-table-column label="操作" width="150" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                  <el-button
                    size="mini"
                    type="text"
                    icon="el-icon-s-promotion"
                    @click="downloadEmp(scope.row.conId)"
                  >合同下载
                  </el-button>
                </template>
              </el-table-column>
            </el-table>
          </el-tab-pane>
          <el-tab-pane label="材料附件" name="fourth">
            <el-form :model="formData" ref="formData">
              <el-form-item prop="empId">
                <el-input type="hidden" v-model="formData.empId"/>
              </el-form-item>
              <el-row :gutter="24">
                <el-col :span="8">
                  <el-form-item label="身份证正面" prop="certificateFront">
                    <el-upload
                      class="avatar-uploader"
                      action="1"
                      :show-file-list="false"
                      :on-success="handleAvatarSuccessFront"

                      :http-request="uploadFront">
                      <img v-if="enclosure.certificateFront"
                           :src="'http://127.0.0.1/'+enclosure.certificateFront" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="身份证反面" prop="certificateBack">
                    <el-upload
                      class="avatar-uploader"
                      action="1"
                      :show-file-list="false"
                      :on-success="handleAvatarSuccessBack"

                      :http-request="uploadBack">
                      <img v-if="enclosure.certificateBack"
                           :src="'http://127.0.0.1/'+enclosure.certificateBack" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="毕 业 证" prop="diploma">
                    <el-upload
                      class="avatar-uploader"
                      action="1"
                      :show-file-list="false"
                      :on-success="handleAvatarSuccessDiploma"

                      :http-request="uploadDiploma">
                      <img v-if="enclosure.diploma" :src="'http://127.0.0.1/'+enclosure.diploma"
                           class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="24">
                <el-col :span="8">
                  <el-form-item label="学 位 证" prop="degreesDiploma">
                    <el-upload
                      class="avatar-uploader"
                      action="1"
                      :show-file-list="false"
                      :on-success="handleAvatarSuccessDegreesDiploma"

                      :http-request="uploadDegreesDiploma">
                      <img v-if="enclosure.degreesDiploma" :src="'http://127.0.0.1/'+enclosure.degreesDiploma"
                           class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item label="离职证明" prop="leavingCertificate">
                    <el-upload
                      class="avatar-uploader"
                      action="1"
                      :show-file-list="false"
                      :on-success="handleAvatarSuccessCertificate"

                      :http-request="uploadCertificate">
                      <img v-if="enclosure.leavingCertificate"
                           :src="'http://127.0.0.1/'+enclosure.leavingCertificate" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
                <el-col :span="8">
                  <el-form-item prop="examinationReport" label="体检报告">
                    <el-upload
                      class="avatar-uploader"
                      action="1"
                      :show-file-list="false"
                      :on-success="handleAvatarSuccessReport"

                      :http-request="uploadReport">
                      <img v-if="enclosure.examinationReport"
                           :src="'http://127.0.0.1/'+enclosure.examinationReport" class="avatar">
                      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                    </el-upload>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row :gutter="24">
                <el-col :span="24">
                  <el-form-item>
                    <el-button type="primary" @click="submitFormData()">提交</el-button>
                  </el-form-item>
                </el-col>
              </el-row>
            </el-form>
          </el-tab-pane>
          <el-tab-pane label="工资社保" name="shebao">
            <el-descriptions class="margin-top" title="工资信息" :column="2" size="size">
              <template slot="extra">
                <el-button
                  size="small"
                  type="text"
                  icon="el-icon-edit"
                  @click="salaryUse()"
                  v-hasPermi="['system:security:updateSalary']">编辑
                </el-button>
              </template>
              <el-descriptions-item label="试用期薪资">{{ itoSecurity.sySalary }}</el-descriptions-item>
              <el-descriptions-item label="转正薪资">{{ itoSecurity.zzSalary }}</el-descriptions-item>
              <el-descriptions-item label="岗位结算价">{{ itoSecurity.gwPrice }}</el-descriptions-item>
              <el-descriptions-item label="试用期结算价">{{ itoSecurity.syPrice }}</el-descriptions-item>
            </el-descriptions>
            <el-descriptions class="margin-top" title="工资卡信息" :column="2" size="size">
              <el-descriptions-item label="银行卡号">{{ employeefiles.bankCardNo }}</el-descriptions-item>
              <el-descriptions-item label="开户行地址">{{ employeefiles.bankAddress }}</el-descriptions-item>
              <el-descriptions-item label="银行名称">{{ employeefiles.bankName }}</el-descriptions-item>
            </el-descriptions>
            <el-descriptions class="margin-top" title="社保信息" :column="2" size="size">
              <template slot="extra">
                <el-button
                  size="small"
                  type="text"
                  icon="el-icon-edit"
                  @click="securityUse()"
                  v-hasPermi="['system:security:updateSalary']">编辑
                </el-button>
              </template>
              <el-descriptions-item label="社保缴纳城市">{{ scheme.schemeCity }}</el-descriptions-item>
              <el-descriptions-item label="参保起始日期">{{ parseTime(scheme.createTime, '{y}-{m}-{d}') }}
              </el-descriptions-item>
              <el-descriptions-item label="是否是首次本地缴纳社保">
                      <span v-if="employeefiles.isFirstSecurity == 0 || employeefiles.isFirstSecurity == null ">
                        否
                      </span>
                <span v-if="employeefiles.isFirstSecurity == 1">
                        是
                      </span>
              </el-descriptions-item>
              <el-descriptions-item label="个人公积金账号">{{ employeefiles.gjNumber }}</el-descriptions-item>
              <el-descriptions-item label="是否是首次本地缴纳公积金">
                      <span v-if="employeefiles.isFirstAccumulationFund == 0 || employeefiles.isFirstAccumulationFund == null ">
                        否
                      </span>
                <span v-if="employeefiles.isFirstAccumulationFund == 1">
                        是
                      </span>
              </el-descriptions-item>
              <el-descriptions-item label="个人社保账号">{{ employeefiles.sbNumber }}</el-descriptions-item>
              <el-descriptions-item label="社保方案" v-if="scheme.schemeName != null">{{ scheme.schemeName }} <el-button
                style="padding-left: 60px"
                size="medium"
                type="text"
                @click="findById"
              >查看
              </el-button></el-descriptions-item>
              <el-descriptions-item label="社保方案" v-if="scheme.schemeName == null">未选择社保方案</el-descriptions-item>


            </el-descriptions>
          </el-tab-pane>
        </el-tabs>
      </template>


    </el-dialog>

    <el-dialog :title="title" :visible.sync="salaryOpen" width="90%" append-to-body>
      <el-form ref="salaryForm" :model="itoSalaryForm" label-width="120px">
        <el-tag type="success">工资信息</el-tag>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="银行卡号" prop="name">
              <input type="text" class="el-input__inner" placeholder="请输入银行卡号" v-model.lazy="itoSalaryForm.cardNumber">
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开户行地址" prop="bankAddress">
              <input type="text" class="el-input__inner" placeholder="请输入开户行地址" v-model.lazy="itoSalaryForm.bankAddress">
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="银行名称" prop="bankName">
              <input type="text" class="el-input__inner" placeholder="请输入银行名称" v-model.lazy="itoSalaryForm.bankName">
            </el-form-item>
          </el-col>
        </el-row>

        <el-tag type="success">工资卡信息</el-tag>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="试用期薪资" prop="sySalary">
              <input type="text" class="el-input__inner" placeholder="试用期薪资" v-model.lazy="itoSalaryForm.sySalary">
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="转正薪资" prop="zzSalary">
              <input type="text" class="el-input__inner" placeholder="请输入转正薪资" v-model.lazy="itoSalaryForm.zzSalary">
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="岗位结算价" prop="gwPrice">
              <input type="text" class="el-input__inner" placeholder="请输入转正薪资" v-model.lazy="itoSalaryForm.gwPrice">
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="试用期结算价" prop="syPrice">
              <input type="text" class="el-input__inner" placeholder="请输入转正薪资" v-model.lazy="itoSalaryForm.syPrice">
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="24">
            <el-table :data="empSalary" border
                      :header-cell-style="{background:'#cccccc'}" style="width: 100%">
              <el-table-column align="center" prop="typeName" label="薪资项目"/>
              <el-table-column align="center" prop="periodLater" label="试用期工资"/>
              <el-table-column align="center" prop="memberLater" label="转正工资"/>
            </el-table>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="salaryUpdate">确 定</el-button>
        <el-button @click="salaryCancel">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="securityOpen" width="90%" append-to-body>
      <el-form ref="securityForm" :model="SecurityFrom" label-width="120px">

        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label-width="170px" label="是否是首次本地缴纳社保" prop="isFirstSecurity">
              <el-radio v-model="SecurityFrom.isFirstSecurity" label="1">是</el-radio>
              <el-radio v-model="SecurityFrom.isFirstSecurity" label="0">否</el-radio>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label-width="180px" label="是否是首次本地缴纳公积金" prop="isFirstAccumulationFund">
              <el-radio v-model="SecurityFrom.isFirstAccumulationFund" label="1">是</el-radio>
              <el-radio v-model="SecurityFrom.isFirstAccumulationFund" label="0">否</el-radio>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label="个人公积金账号" prop="accumulationFundNum">
              <el-input v-model="SecurityFrom.gjNumber" placeholder="个人公积金账号"/>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="个人社保账号" prop="securityNum">
              <el-input v-model="SecurityFrom.sbNumber" placeholder="请输入个人社保账号"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="securityUpdate">确 定</el-button>
        <el-button @click="securityCancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 添加或修改员工档案对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="75%" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-tag type="success">基本信息</el-tag>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="姓名" prop="name">
              <el-input  v-model="form.name" placeholder="请输入"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="性别" prop="gender">
              <el-select  v-model="form.gender" placeholder="请选择性别" style="width: 100%">
                <el-option label="男" value="男"></el-option>
                <el-option label="女" value="女"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="年龄" prop="age">
              <el-input  v-model="form.age" placeholder="请输入年龄"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="出生日期" prop="dateOfBirth">
              <el-date-picker clearable
                              style="width: 100%"
                              v-model="form.dateOfBirth"
                              type="date"
                              value-format="yyyy-MM-dd HH:mm:ss"
                              placeholder="请选择">
              </el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="是否已婚" prop="isMarriage">
              <el-select  v-model="form.isMarriage" placeholder="请选择" style="width: 100%">
                <el-option label="未婚" value="未婚"></el-option>
                <el-option label="已婚" value="已婚"></el-option>
                <el-option label="离异" value="离异"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="是否生育" prop="isBirth">
              <el-select  v-model="form.isBirth" placeholder="请选择" style="width: 100%">
                <el-option label="是" value="是"></el-option>
                <el-option label="否" value="否"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="民族" prop="ethnicGroup">
              <el-input  v-model="form.ethnicGroup" placeholder="请输入民族"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="政治面貌" prop="politicalOutlook">
              <el-input  v-model="form.politicalOutlook" placeholder="请输入"/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="证件类型" prop="documentType">
              <el-select  v-model="form.documentType" placeholder="请选择证件类型" style="width: 100%">
                <el-option label="--请选择--" value=""></el-option>
                <el-option label="身份证" value="身份证"></el-option>
                <el-option label="港澳居民来往证明" value="港澳居民来往证明"></el-option>
                <el-option label="香港身份证" value="香港身份证"></el-option>
                <el-option label="台湾居民来往大陆通行证" value="台湾居民来往大陆通行证"></el-option>
                <el-option label="台湾身份证" value="台湾身份证"></el-option>
                <el-option label="澳门身份证" value="澳门身份证"></el-option>
                <el-option label="外国护照" value="外国护照"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="证件号码" prop="identificationNumber">
              <el-input  v-model="form.identificationNumber" placeholder="请输入证件号码"/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="户籍类型" prop="registeredType">
              <el-select  v-model="form.registeredType" placeholder="请选择户籍类型" style="width: 100%">
                <el-option label="--请选择--" value=""></el-option>
                <el-option label="农村户口" value="农村户口"></el-option>
                <el-option label="城镇户口" value="城镇户口"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="户籍所在地" prop="registeredResidence">
              <el-input  v-model="form.registeredResidence" placeholder="请输入户籍所在地"/>
            </el-form-item>
          </el-col>
        </el-row>
        <!--        <el-row :gutter="24">
                  <el-col :span="10">
                    <el-form-item label="电话号码" prop="phone">
                      <el-input v-model="form.phone" placeholder="请输入电话号码"/>
                    </el-form-item>
                  </el-col>
                </el-row>
                <el-row :gutter="24">
                  <el-col :span="10">
                    <el-form-item label="邮箱" prop="mailbox">
                      <el-input v-model="form.mailbox" placeholder="请输入邮箱"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="现住地址" prop="currentAddress">
                      <el-input v-model="form.currentAddress" placeholder="请输入现住地址"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="紧急联系人" prop="emergencyContact">
                      <el-input v-model="form.emergencyContact" placeholder="请输入紧急联系人"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="紧急联系人电话" prop="emergencyContactNumber">
                      <el-input v-model="form.emergencyContactNumber" placeholder="请输入紧急联系人电话"/>
                    </el-form-item>
                  </el-col>
                </el-row>-->
        <el-tag type="success">通讯信息</el-tag>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="电话" prop="phone">
              <el-input  type="number" v-model="form.phone" placeholder="请输入电话号码"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="邮箱" prop="mailbox">
              <el-input v-model="form.mailbox" placeholder="请输入邮箱"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="现住地址" prop="currentAddress">
              <el-input  v-model="form.currentAddress" placeholder="请输入现住址"/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="紧急联系人" prop="emergencyContact">
              <el-input  v-model="form.emergencyContact" placeholder="请输入紧急联系人"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="紧急联系人电话" prop="emergencyContactNumber">
              <el-input type="number"  v-model="form.emergencyContactNumber" placeholder="请输入紧急联系人电话"/>
            </el-form-item>
          </el-col>
        </el-row>
        <!--        <el-row :gutter="24">
                  <el-col :span="10">
                    <el-form-item label="学校名称" prop="schoolName">
                      <el-input v-model="form.schoolName" placeholder="请输入学校名称"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="学历" prop="education">
                      <el-select v-model="form.education" placeholder="请选择学历">
                        <el-option label="初中" value="初中"></el-option>
                        <el-option label="高中" value="高中"></el-option>
                        <el-option label="中专" value="中专"></el-option>
                        <el-option label="大专" value="大专"></el-option>
                        <el-option label="本科" value="本科"></el-option>
                        <el-option label="硕士" value="硕士"></el-option>
                        <el-option label="博士" value="博士"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="10">
                    <el-form-item label="所学专业" prop="major">
                      <el-input v-model="form.major" placeholder="请输入所学专业"/>
                    </el-form-item>
                  </el-col>
                </el-row>-->
        <el-tag type="success">学历信息</el-tag>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="学校名称" prop="schoolName">
              <el-input  v-model="form.schoolName" placeholder="请输入学校名称"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所学专业" prop="major">
              <el-input  v-model="form.major" placeholder="请输入所学专业"/>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="12">
            <el-form-item label="学历" prop="education">
              <el-select  v-model="form.education" placeholder="请选择学历" style="width: 100%">
                <el-option label="请选择" value=""></el-option>
                <el-option label="不限" value="不限"></el-option>
                <el-option label="专科" value="大专"></el-option>
                <el-option label="本科" value="本科"></el-option>
                <el-option label="硕士" value="硕士"></el-option>
                <el-option label="博士" value="博士"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>

        <!--
                <el-form-item label="银行卡号" prop="bankCardNo">
                  <el-input v-model="form.bankCardNo" placeholder="请输入银行卡号" />
                </el-form-item>
                <el-form-item label="开户地址" prop="bankAddress">
                  <el-input v-model="form.bankAddress" placeholder="请输入开户地址" />
                </el-form-item>
                <el-form-item label="银行名称" prop="bankName">
                  <el-input v-model="form.bankName" placeholder="请输入银行名称" />
                </el-form-item>
                <el-form-item label="工号" prop="jobNo">
                  <el-input v-model="form.jobNo" placeholder="请输入工号" />
                </el-form-item>
                <el-form-item label="部门" prop="deptName">
                  <el-input v-model="form.deptName" placeholder="请输入部门" />
                </el-form-item>
                <el-form-item label="职称" prop="title">
                  <el-input v-model="form.title" placeholder="请输入职称" />
                </el-form-item>
                <el-form-item label="入职日期" prop="employmentDate">
                  <el-date-picker clearable
                    v-model="form.employmentDate"
                    type="date"
                    value-format="yyyy-MM-dd"
                    placeholder="请选择入职日期">
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="试用期" prop="probationPeriod">
                  <el-input v-model="form.probationPeriod" placeholder="请输入试用期" />
                </el-form-item>
                <el-form-item label="应聘岗位" prop="positionApplied">
                  <el-input v-model="form.positionApplied" placeholder="请输入应聘岗位" />
                </el-form-item>
                <el-form-item label="企业" prop="enterprise">
                  <el-input v-model="form.enterprise" placeholder="请输入企业" />
                </el-form-item>
                <el-form-item label="入职登记(0,1)" prop="enrollmentRegistration">
                  <el-input v-model="form.enrollmentRegistration" placeholder="请输入入职登记(0,1)" />
                </el-form-item>
                <el-form-item label="合同签署(0,1)" prop="contractSigning">
                  <el-input v-model="form.contractSigning" placeholder="请输入合同签署(0,1)" />
                </el-form-item>
                <el-form-item label="社保定薪(0,1)" prop="socialSecuritySalary">
                  <el-input v-model="form.socialSecuritySalary" placeholder="请输入社保定薪(0,1)" />
                </el-form-item>
                <el-form-item label="逻辑删除" prop="isDelete">
                  <el-input v-model="form.isDelete" placeholder="请输入逻辑删除" />
                </el-form-item>  -->


      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 修改工作信息对话框 -->
    <el-dialog :title="title" :visible.sync="open1" width="900px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">

        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label="岗位" prop="positionApplied">
              <el-input v-model="form.positionApplied" placeholder="请输入应聘岗位"/>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="职位" prop="title">
              <treeselect   @input="parentIdChange" v-model="form.title"   :options="postOptions" :show-count="true" placeholder="请选择职位"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label="入职日期" prop="employmentDate">
              <el-date-picker clearable
                              v-model="form.employmentDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择入职日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="试用期" prop="probationPeriod">
              <el-input v-model="form.probationPeriod" placeholder="请输入试用期"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label="转正日期" prop="employmentDate">
              <el-date-picker clearable
                              v-model="form.employmentDate"
                              type="date"
                              value-format="yyyy-MM-dd"
                              placeholder="请选择转正日期">
              </el-date-picker>
            </el-form-item>
          </el-col>
         <!-- <el-col :span="10">
            <el-form-item label="签约公司" prop="enterprise">
              <el-input v-model="form.enterprise" placeholder="请输入企业"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
        <!--  <el-col :span="10">
            <el-form-item label="驻场企业" prop="enterprise">
              <el-input v-model="form.enterprise" placeholder="请输入企业"/>
            </el-form-item>
          </el-col>-->
          <el-col :span="10">
            <el-form-item label="工作地点" prop="enterprise">
              <el-input v-model="form.enterprise" placeholder=""/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label="归属部门" prop="deptName">
              <treeselect   @input="parentIdChange" v-model="form.deptName"   :options="deptOptions" :show-count="true" placeholder="请选择归属部门"/>
            </el-form-item>
            <!--            <el-form-item label="部门" prop="deptName">
                          <el-input v-model="form.deptName" placeholder="请输入部门"/>
                        </el-form-item>-->
          </el-col>
          <el-col :span="10">
            <el-form-item label="工作性质" prop="probationPeriod">
              <el-input v-model="form.workNature" placeholder="请输入工作性质"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="10">
            <el-form-item label="岗位类型" prop="probationPeriod">
              <el-input v-model="form.positionType" placeholder="请输入岗位类型"/>
            </el-form-item>
          </el-col>
        </el-row>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <!-- 详情对话框 -->
    <el-dialog :title="title" :visible.sync="sbopen" width="90%" :close-on-click-modal='false' append-to-body
               border>

      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <h1>员工信息</h1>
        <el-divider></el-divider>
        <el-descriptions :column="2" title="">
          <el-divider></el-divider>
          <!--                    <el-descriptions-item label="ID">{{ employeefiles.id }}</el-descriptions-item>-->
          <el-descriptions-item label="姓名">{{ form.name }}</el-descriptions-item>

          <el-descriptions-item label="员工状态" v-if="form.status == 3">试用</el-descriptions-item>
          <el-descriptions-item label="员工状态" v-if="form.status == 4">正式</el-descriptions-item>
          <el-descriptions-item label="工号">{{ form.jobNo }}</el-descriptions-item>
          <el-descriptions-item label="入职日期">{{ form.employmentDate }}</el-descriptions-item>
          <el-descriptions-item label="证件类型">{{ form.documentType }}</el-descriptions-item>
          <el-descriptions-item label="证件号码">{{ form.identificationNumber }}</el-descriptions-item>
          <el-descriptions-item label="个人社保号">{{ form.sbNumber }}</el-descriptions-item>
          <el-descriptions-item label="个人公积金号">{{ form.gjNumber }}</el-descriptions-item>
        </el-descriptions>
        <h1>参保信息</h1>
        <el-divider></el-divider>
        <el-descriptions :column="2" title="">
          <el-divider></el-divider>
          <!--                    <el-descriptions-item label="ID">{{ employeefiles.id }}</el-descriptions-item>-->
          <el-descriptions-item label="方案名称">{{ form.schemeName }}</el-descriptions-item>
          <el-descriptions-item label="参保平台">{{ form.schemePlatform }}</el-descriptions-item>
          <el-descriptions-item label="参保城市">{{ form.schemeCity }}</el-descriptions-item>

        </el-descriptions>
        <h1>社保</h1>
        <el-divider></el-divider>
        <table border="1" cellspacing="1" cellpadding="0" bordercolor="#87cefa">
          <tr bgcolor="#87cefa">
            <td colspan="4" height="40" align="center">个人缴纳</td>
            <td colspan="4" height="40" align="center">企业缴纳</td>
          </tr>
          <tr bgcolor="#87cefa">
            <td width="11%" height="40" align="center">缴费项目</td>
            <td width="11%" height="40" align="center">基数</td>
            <td width="11%" height="40" align="center">缴费比例</td>
            <td width="11%" height="40" align="center">金额</td>
            <td width="11%" height="40" align="center">基数</td>
            <td width="11%" height="40" align="center">缴费比例</td>
            <td width="11%" height="40" align="center">金额</td>
            <td width="11%" height="40" align="center">小计</td>
          </tr>
          <tr>
            <td align="center">养老保险</td>
            <td>
              <el-input :disabled="true" v-model="form.grYlBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grYlProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grYlMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyYlBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyYlProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyYlMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.ylInsuranceMoney" placeholder="00.00"/>
            </td>
          </tr>
          <tr>
            <td align="center">工商保险</td>
            <td>
              <el-input :disabled="true" v-model="form.grGsBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grGsProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grGsMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyGsBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyGsProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyGsMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.gsInsuranceMoney" placeholder="00.00"/>
            </td>
          </tr>
          <tr>
            <td align="center">失业保险</td>
            <td>
              <el-input :disabled="true" v-model="form.grSyBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grSyProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grSyMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companySyBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companySyProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companySyMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.syInsuranceMoney" placeholder="00.00"/>
            </td>
          </tr>
          <tr>
            <td align="center">生育保险</td>
            <td>
              <el-input :disabled="true" v-model="form.grBirthBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grBirthProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grBirthMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyBirthBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyBirthProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyBirthMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.birthInsuranceMoney" placeholder="00.00"/>
            </td>
          </tr>
          <tr>
            <td align="center">医疗保险</td>
            <td>
              <el-input :disabled="true" v-model="form.grCareBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grCareProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grCareMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyCareBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyCareProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyCareMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.careInsuranceMoney" placeholder="00.00"/>
            </td>
          </tr>
          <tr>
            <td></td>
            <td align="center" colspan="3">个人缴纳：<input :disabled="true" v-model="form.grInsuranceMoney"
                                                       placeholder="00.00"/></td>
            <td align="center" colspan="3">公司缴纳：<input :disabled="true" v-model="form.companyInsuranceMoney"
                                                       placeholder="00.00"/></td>
            <td>合计：<input :disabled="true" v-model="form.insuranceMoney" placeholder="00.00"/></td>
          </tr>
        </table>
        <h1>公积金</h1>
        <el-divider></el-divider>
        <table border="1" cellspacing="1" cellpadding="0" bordercolor="#87cefa">
          <tr bgcolor="#87cefa">
            <td colspan="4" height="40" align="center">个人缴纳</td>
            <td colspan="4" height="40" align="center">企业缴纳</td>
          </tr>
          <tr bgcolor="#87cefa">
            <td height="40" width="11%" align="center">缴费项目</td>
            <td height="40" width="11%" align="center">基数</td>
            <td height="40" width="11%" align="center">缴费比例</td>
            <td height="40" width="11%" align="center">金额</td>
            <td height="40" width="11%" align="center">基数</td>
            <td height="40" width="11%" align="center">缴费比例</td>
            <td height="40" width="11%" align="center">金额</td>
            <td height="40" width="11%" align="center">小计</td>
          </tr>
          <tr>
            <td align="center">公积金</td>
            <td>
              <el-input :disabled="true" v-model="form.grFundBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grFundProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.grFundMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyFundBase" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyFundProportion" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.companyFundMoney" placeholder="00.00"/>
            </td>
            <td>
              <el-input :disabled="true" v-model="form.fundSubtotal" placeholder="00.00"/>
            </td>
          </tr>

          <tr>
            <td></td>
            <td align="center" colspan="3">个人缴纳：<input :disabled="true" v-model="form.grFundPayment"
                                                       placeholder="00.00"/></td>
            <td align="center" colspan="3">公司缴纳：<input :disabled="true" v-model="form.companyFundPayment"
                                                       placeholder="00.00"/></td>
            <td>合计：<input :disabled="true" v-model="form.fundTotal" placeholder="00.00"/></td>
          </tr>
        </table>
      </el-form>
    </el-dialog>
  </div>
</template>

<script>
import {
  listEmployeefiles,
  addEnclosure,
  getContract,
  statisticsNum,
  giveUp,
  listContract,
  selectRoster,
  getEmployeefiles,
  delEmployeefiles,
  addEmployeefiles,
  updateEmployeefiles,
  upload
} from "@/api/system/employeefiles";
import {rzdxAdd} from '@/api/system/Management'
import {getEnclosure, updateEnclosure} from '@/api/system/enclosure';

import {postTreeSelect} from '@/api/system/org'
// import {deptTreeSelect} from '@/api/system/dict';
import {deptTreeSelect } from "@/api/system/user"
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"
import {
  selectSecurityById,
  updateSalary,
  selectById,
  updateSecurity
} from '@/api/system/security';
import {rzdxfindById} from '@/api/system/Management';
import {getScheme} from '@/api/system/scheme'
import {TextToCode} from 'element-china-area-data'
import {getEmpSalaryListByEmpId} from "@/api/system/employeeSalary";


export default {
  components: {Treeselect},
  name: "Employeefiles",
  data() {
    return {
      id:null,
      scheme:{},
      securityOpen : false,
      sbopen : false,
      postOptions: undefined,
      itoSecurityFrom: {
        securityAddress: null,
        securityStartTime: null,
        isFirstSecurity: '0',
        accumulationFundNum: null,
        isFirstAccumulationFund: '0',
        securityNum: null,
        saId: 0,
        proId: 0,
      },
      SecurityFrom: {
        id:0,

        isFirstSecurity: '0',

        isFirstAccumulationFund: '0',
        sbNumber:null,
        gjNumber:null
      },
      itoSecurity: {
        id: 0,
        securityAddress: null,
        securityStartTime: null,
        isFirstSecurity: null,
        accumulationFundNum: null,
        isFirstAccumulationFund: null,
        securityNum: null,
        saId: 0,
        eid: 0,
        proId: 0,
        projectName: null,
        cardNumber: null,
        bankAddress: null,
        bankName: null,
        sySalary: null,
        zzSalary: null
      },
      itoSalaryForm: {
        id: 0,
        eid: 0,
        cardNumber: 0,
        bankAddress: '',
        bankName: '',
        sySalary: '',
        zzSalary: ''
      },
      salaryOpen: false,
      formData: {
        certificateFront: null,
        certificateBack: null,
        diploma: null,
        degreesDiploma: null,
        leavingCertificate: null,
        examinationReport: null,
        empId: null
      },
      enclosure: {
        certificateFront: '',
        certificateBack: '',
        diploma: '',
        degreesDiploma: '',
        leavingCertificate: '',
        examinationReport: '',
        empId: null
      },
      imageUrl: '',
      activeName: 'first',
      // 遮罩层
      loading: true,
      loadingContract: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      statisticsNum: {
        count0: null,
        count1: null,
        count2: null,
        count3: null
      },
      totalContract: 0,
      // 合同表格数据
      contract: [],
      // contractList: [],
      // 员工档案表格数据
      employeefilesList: [],
      deptOptions: undefined,
      employeefiles: {
        id: null,
        name: null,
        gender: null,
        age: null,
        dateOfBirth: null,
        isMarriage: null,
        isBirth: null,
        ethnicGroup: null,
        politicalOutlook: null,
        documentType: null,
        identificationNumber: null,
        registeredResidence: null,
        phone: null,
        dname: null,
        post: null,
        mailbox: null,
        currentAddress: null,
        emergencyContact: null,
        emergencyContactNumber: null,
        schoolName: null,
        education: null,
        major: null,
        bankCardNo: null,
        bankAddress: null,
        bankName: null,
        jobNo: null,
        deptName: null,
        title: null,
        workNature: null,
        employmentDate: null,
        probationPeriod: null,
        positionApplied: null,
        positionType: null,
        enterprise: null,
        status: null,
        enrollmentRegistration: null,
        contractSigning: null,
        socialSecuritySalary: null,
        isDelete: null,
      },
      contractList: {
        pageNum: 1,
        pageSize: 10,
        enterPrise: null,
        conId: null,
        id: null,
        name: null,
        filePath: null,
        stationName: null,
        contractNo: null,
        residentEnterprises: null,
        staffStatus: null,
        type: null,
        contractStatus: null,
        contractPeriod: null,
        auditTime: null,
        endTime: null,
        createBy: null,
        updateBy: null,
        isContract: null,
        signingTimes: null,
        beginTime: null,
        endTimee: null,
        isDelete: null,
      },
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open1: false,
      dialogVisible: false,
      videoVisible: false,
      options: [
        {
          value: '',
          label: '请选择'
        }, {
          value: '个人原因',
          label: '个人原因'
        }, {
          value: '合同到期',
          label: '合同到期'
        }, {
          value: '职业发展',
          label: '职业发展'
        }, {
          value: '试用期未通过',
          label: '试用期未通过'
        }, {
          value: '其他',
          label: '其他'
        }
      ],
      /*离职原因*/
      leavingReason: null,
      sid:null,
      emp:{},
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        gender: null,
        age: null,
        dateOfBirth: null,
        isMarriage: null,
        isBirth: null,
        ethnicGroup: null,
        politicalOutlook: null,
        documentType: null,
        identificationNumber: null,
        registeredResidence: null,
        phone: null,
        mailbox: null,
        currentAddress: null,
        emergencyContact: null,
        emergencyContactNumber: null,
        schoolName: null,
        education: null,
        major: null,
        bankCardNo: null,
        bankAddress: null,
        bankName: null,
        jobNo: null,
        deptName: null,
        title: null,
        workNature: null,
        employmentDate: null,
        probationPeriod: null,
        positionApplied: null,
        positionType: null,
        enterprise: null,
        status: null,
        enrollmentRegistration: null,
        contractSigning: null,
        socialSecuritySalary: null,
        isDelete: null,
        all: null,
      },
      queryParamsContract: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        stationName: null,
        contractNo: null,
        residentEnterprises: null,
        staffStatus: null,
        type: null,
        contractStatus: null,
        contractPeriod: null,
        auditTime: null,
        endTime: null,
        createBy: null,
        updateBy: null,
        isContract: null,
        signingTimes: null,
        beginTime: null,
        endTimee: null,
        isDelete: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
      empSalary:[]
    };
  },
  created() {
    this.getDeptTree();
    this.getPostTree()
    this.getList();
    this.getListContract();
    this.statistics();
  },
  methods: {
    closeVideo(){
      this.videoVisible = false
      this.employeefiles = {}
      this.contract = []
      this.formData = {}
      this.itoSecurity = {}
      this.scheme = {}
      this.enclosure = {}
    },
    downloadEmp(conId) {
      this.$download.hetzip(conId)
    },
    securityUse(){
      this.title = '编辑';

      getEmployeefiles(this.employeefiles.id).then(resp =>{

        this.SecurityFrom = resp.data;


        if (resp.data.isFirstSecurity == 0){
          this.SecurityFrom.isFirstSecurity = '0'
        }else if(resp.data.isFirstSecurity == 1) {
          this.SecurityFrom.isFirstSecurity = '1'
        }

        if (resp.data.isFirstAccumulationFund == 0){
          this.SecurityFrom.isFirstAccumulationFund = '0'
        }else if(resp.data.isFirstAccumulationFund == 1) {
          this.SecurityFrom.isFirstAccumulationFund = '1'
        }


      })
      this.securityOpen = true;
    },

    securityUpdate(){
      updateEmployeefiles(this.SecurityFrom).then(resp =>{
        this.securityOpen = false;
        this.$modal.msgSuccess("修改成功");
        this.playVideo(this.employeefiles.id)
        this.SecurityFrom = {}
      })
    },
    securityCancel(){
      this.securityOpen = false;

    },
    salaryUse() {
      this.title = '编辑';
      rzdxfindById(this.employeefiles.id).then(resp =>{
        this.itoSalaryForm = resp.data;
      })
      getEmpSalaryListByEmpId(this.employeefiles.id).then(res => {
        this.empSalary = res.data
      })
      this.salaryOpen = true
    },

    salaryUpdate() {
      if (this.itoSecurity.id == null || this.itoSecurity.id == 0){
        this.itoSalaryForm.eid = this.employeefiles.id
        rzdxAdd(this.itoSalaryForm).then(response => {
          this.emp.id = this.id;
          this.emp.isSalary = 1;
          updateEmployeefiles(this.emp).then(response => {});

          this.playVideo(this.itoSalaryForm.eid)
          this.$modal.msgSuccess("修改成功");
          this.salaryOpen = false;
          this.itoSalaryForm = {}
        });
      }else {
        updateSalary(this.itoSalaryForm).then(resp => {
          this.salaryOpen = false;
          this.$modal.msgSuccess("修改成功");
          this.playVideo(this.itoSalaryForm.eid)
          this.itoSalaryForm = {}
        })
      }
    },
    salaryCancel() {
      this.salaryOpen = false;
    },
    closeEnclosure() {
      this.itoSecurityFrom = {}
      this.formData = {
        id: null,
        certificateFront: null,
        certificateBack: null,
        diploma: null,
        degreesDiploma: null,
        leavingCertificate: null,
        examinationReport: null,
        empId: null
      }
      this.enclosure = {
        id: null,
        certificateFront: '',
        certificateBack: '',
        diploma: '',
        degreesDiploma: '',
        leavingCertificate: '',
        examinationReport: '',
        empId: null
      }
      this.itoSecurity = {
        id: null,
        securityAddress: null,
        securityStartTime: null,
        isFirstSecurity: null,
        accumulationFundNum: null,
        isFirstAccumulationFund: null,
        securityNum: null,
        eid: null,
        proId: null,
        projectName: null,
        cardNumber: null,
        bankAddress: null,
        bankName: null,
        sySalary: null,
        zzSalary: null
      }
      this.videoVisible = false;
    },
    uploadFront(file) {
      var formdata = new FormData();
      formdata.append("file", file.file);
      upload(formdata).then((res) => {
        this.enclosure.certificateFront = res.msg;
        this.formData.certificateFront = res.msg;

      });
    },
    handleAvatarSuccessFront(res, file) {
      this.formData.certificateFront = URL.createObjectURL(file.raw);
    },
    uploadBack(file) {
      var formdata = new FormData();
      formdata.append("file", file.file);
      upload(formdata).then((res) => {
        this.enclosure.certificateBack = res.msg;
        this.formData.certificateBack = res.msg;

      });
    },
    handleAvatarSuccessBack(res, file) {
      this.formData.certificateBack = URL.createObjectURL(file.raw);
    },
    uploadDiploma(file) {
      var formdata = new FormData();
      formdata.append("file", file.file);
      upload(formdata).then((res) => {
        this.formData.diploma = res.msg;

      });
    },
    handleAvatarSuccessDiploma(res, file) {
      this.formData.diploma = URL.createObjectURL(file.raw);
    },
    uploadDegreesDiploma(file) {
      var formdata = new FormData();
      formdata.append("file", file.file);
      upload(formdata).then((res) => {
        this.formData.degreesDiploma = res.msg;

      });
    },
    handleAvatarSuccessDegreesDiploma(res, file) {
      this.formData.degreesDiploma = URL.createObjectURL(file.raw);
    },
    uploadCertificate(file) {
      var formdata = new FormData();
      formdata.append("file", file.file);
      upload(formdata).then((res) => {
        this.formData.leavingCertificate = res.msg;

      });
    },
    handleAvatarSuccessCertificate(res, file) {
      this.formData.leavingCertificate = URL.createObjectURL(file.raw);
    },
    uploadReport(file) {
      var formdata = new FormData();
      formdata.append("file", file.file);
      upload(formdata).then((res) => {
        this.formData.examinationReport = res.msg;

      });
    },
    handleAvatarSuccessReport(res, file) {
      this.formData.examinationReport = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
      const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
      const isLt2M = file.size / 1024 / 1024 < 2;

      if (!isJPG) {
        this.$message.error('上传图片只能是 JPG 格式!');
      }
      if (!isLt2M) {
        this.$message.error('上传图片大小不能超过 2MB!');
      }
      return isJPG && isLt2M;
    },
    submitFormData() {

      this.$refs["formData"].validate(valid => {
        if (valid) {
          this.formData.empId = this.employeefiles.id
          if (this.enclosure.empId != null) {
            updateEnclosure(this.formData).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.videoVisible = false;
            });
          } else {
            addEnclosure(this.formData).then(resp => {
              this.$modal.msgSuccess("新增成功");
              this.videoVisible = false;
            })
          }
        }
      });
    },
    handleClick(tab, event) {
    },
    abc(s) {
      var path = null;
      if (s == 0) {
        path = 'roster'
      }
      if (s == 3) {
        path = 'rostertrial'
      }
      if (s == 4) {
        path = 'rosterformal'
      }
      if (s == 6) {
        path = 'rosterquit'
      }
      this.$router.push({path: '/employeefiles/1/' + path}).catch(() => {
      })
    },
    /** 查询合同管理列表 */
    getListContract() {
      this.loadingContract = true;
      listContract(this.queryParamsContract).then(response => {
        this.contractList = response.rows;
        this.totalContract = response.totalContract;
        this.loadingContract = false;
      });
    },
    /** 查询员工档案列表 */
    getList() {
      this.loading = true;
      listEmployeefiles(this.queryParams).then(response => {
        this.employeefilesList = response.rows;
        this.total = response.total;
      });
      this.loading = false;
    },
    /** 统计数量 */
    statistics() {
      statisticsNum().then(response => {
        this.statisticsNum = response.data;

      });
    },
    /**办理离职按钮 **/
    dialog(id) {
      this.id = id;
      this.dialogVisible = true;
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.open1 = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        name: null,
        gender: null,
        age: null,
        dateOfBirth: null,
        isMarriage: null,
        isBirth: null,
        ethnicGroup: null,
        politicalOutlook: null,
        documentType: null,
        identificationNumber: null,
        registeredResidence: null,
        phone: null,
        mailbox: null,
        currentAddress: null,
        emergencyContact: null,
        emergencyContactNumber: null,
        schoolName: null,
        education: null,
        major: null,
        bankCardNo: null,
        bankAddress: null,
        bankName: null,
        jobNo: null,
        deptName: null,
        title: null,
        workNature: null,
        employmentDate: null,
        probationPeriod: null,
        positionApplied: null,
        positionType: null,
        enterprise: null,
        status: 0,
        enrollmentRegistration: null,
        contractSigning: null,
        socialSecuritySalary: null,
        isDelete: null,
        createTime: null,
        updateTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        name: null,
        gender: null,
        age: null,
        dateOfBirth: null,
        isMarriage: null,
        isBirth: null,
        ethnicGroup: null,
        politicalOutlook: null,
        identificationNumber: null,
        registeredResidence: null,
        phone: null,
        mailbox: null,
        currentAddress: null,
        emergencyContact: null,
        emergencyContactNumber: null,
        schoolName: null,
        education: null,
        major: null,
        bankCardNo: null,
        bankAddress: null,
        bankName: null,
        jobNo: null,
        deptName: null,
        title: null,
        workNature: null,
        employmentDate: null,
        probationPeriod: null,
        positionApplied: null,
        positionType: null,
        enterprise: null,
        status: null,
        enrollmentRegistration: null,
        contractSigning: null,
        socialSecuritySalary: null,
        isDelete: null,
        query: null,
      }
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "编辑";
    },
    /** 修改按钮操作 */
    handleUpdate(id) {
      this.reset();
      const id1 = id || this.ids
      getEmployeefiles(id1).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "编辑";
      });
    },
    /** 修改按钮操作 */
    handleUpdate1(id) {
      this.reset();
      const id1 = id || this.ids
      getEmployeefiles(id1).then(response => {
        this.form = response.data;
        this.open1 = true;
        this.title = "编辑";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateEmployeefiles(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.open1 = false;
              this.getList();
            });
          } else {
            addEmployeefiles(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除员工档案编号为"' + ids + '"的数据项？').then(function () {
        return delEmployeefiles(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 查看档案按钮操作 */
    playVideo(id) {

      this.id = id
      getEmployeefiles(id).then(response => {
        this.employeefiles = response.data;
        this.videoVisible = true
        if (this.employeefiles.sid != null){
          getScheme(this.employeefiles.sid).then(resp => {
            this.scheme = response.data;
          });
        }else {
          this.scheme = {};
        }

      });

      getContract(id).then(response => {

        this.contract = response.data;
        this.totalContract = response.totalContract;
      });
      getEnclosure(id).then(res => {
        if (res.data != null) {
          this.formData = res.data;
          this.enclosure = res.data;
        }
      });
      selectSecurityById(id).then(resp => {
        if (resp != null && resp.data != null) {
          this.itoSecurity = resp.data;

        }
      });


    },
    /**淘汰按钮 **/
    handleDeletes() {
      var id = this.id;
      var leavingReason = this.leavingReason;
      giveUp(id, leavingReason).then(response => {
        this.dialogVisible = false;
        this.$modal.msgSuccess("操作成功");
        this.getList();
        this.statistics();
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/employeefiles/export', {
        ...this.queryParams
      }, `employeefiles_${new Date().getTime()}.xlsx`)
    }
    ,
    parentIdChange(){
      this.$nextTick(()=>{
        this.$refs.form.validateField('deptName')
      })
    },
    /** 查询部门下拉树结构 */
    getDeptTree() {
      deptTreeSelect().then(response => {

        this.deptOptions = response.data;
      });
    },
    /** 查询职位下拉树结构 */
    getPostTree() {
      postTreeSelect().then(response => {

        this.postOptions = response.data;
      });
    },
    findById() {


      var id = this.id
      getEmployeefiles(id).then(response => {

        this.form = response.data;
        var addressStr = new Array(); //定义一数组
        addressStr = (this.form.schemeCity).split("/"); //字符分割
        this.selectedAddressOptions = TextToCode[addressStr[0]][addressStr[1]][addressStr[2]].code;

        this.sbopen = true;
        this.title = "详情";
      });
    },
  }
};
</script>

